import { Cache } from "../../../cache/Cache";
import { ColorItem } from "../../chat/ColorItem";
import { EventName } from "../../../mvc/EventName";
import { DataEvent } from "../../../events/DataEvent";
//class MountCraveColorPicker
    
    export  class MountCraveColorPicker /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.init(Cache.instance.pack.mountsPackCache.craveColorArr);
            return;
        }

        /* internal  */init(arg1: Array<any>): void
        {
            var loc4=null;
            var loc1=0;
            var loc2=arg1.length;
            var loc3=0;
            while (loc3 < loc2) 
            {
                (loc4 = new ColorItem(arg1[loc3])).x = 0;
                loc4.y = loc1;
                loc1 = loc1 + loc4.height;
                loc4.addEventListener(EventName.ChatColorSelect, this.onChatColorSelectHandler);
                addChild(loc4);
                ++loc3;
            }
            return;
        }

        protected onChatColorSelectHandler(arg1: DataEvent): void
        {
            dispatchEvent(new DataEvent(EventName.ChatColorSelect, arg1.data));
            return;
        }
    }
